#pragma once
#include "Infra/Thread.h"
#include "GenICam/StreamSource.h"
#include <opencv2/opencv.hpp>


using namespace Dahua::GenICam;
using namespace Dahua::Infra;
using namespace cv;


class StreamRetrieve : public CThread
{
public:
	StreamRetrieve(IStreamSourcePtr& streamSptr);
	bool start();
	void stop();
	Mat getOrigImage()
	{
		return OrigImage_;
	}
	Mat getMatImage()
	{
		return matImage_;
	}

	bool getCalReady()
	{
		return calMatReady_;
	}

	bool getShowReady()
	{
		return showMatReady_;
	}

	void setCalReady(bool iReady)
	{
		calMatReady_ = iReady;
	}

	void setShowReady(bool iReady)
	{
		showMatReady_ = iReady;
	}
	
	int  getFrameCount()
	{
		return frameCount_;
	}

	double getFrameFps()
	{
		return frameFps_;
	}

private:
	bool calMatReady_;
	bool showMatReady_;
	Mat OrigImage_;
	Mat matImage_;
	void threadProc();
	bool m_isLoop;
	int frameCount_;
	double frameFps_;
	void calFrameFps();
	IStreamSourcePtr m_streamSptr;
};

typedef Dahua::Memory::TSharedPtr<StreamRetrieve> StreamRetrievePtr;


